package com.neko.Thread_Learning;

/** 11、线程合并 -- join
 * ------------------------
 *
 * */
public class t11_Thread_join implements Runnable {

    @Override
    public void run() {
        for (int i=0; i<100; i++ ) {
            System.out.println("线程 vip 来了" + i);
        }

    }

    /**
     * Main
     * */
    public static void main(String[] args) throws InterruptedException {

        // 主线程 操作
        for (int i=0; i<500; i++) {
            if (i == 200) {
                // 启动 我们的 子线程
                t11_Thread_join testJoin = new t11_Thread_join();
                Thread thread = new Thread(testJoin);

                thread.start();

                /**
                 * Thread.join(); Thread 插队执行
                 * */
                thread.join();

            }

            System.out.println("main " + i);
        }
    }
}
